<?php
if( $_GET['harvest'] == 'true') {
	


	$dir = str_replace( 'bantayden.php', '', __FILE__);
	$app_dir = dirname( $_SERVER["SCRIPT_FILENAME"]).'/app/';

	if( $_POST) {
		pre2( $_POST);
		extract( $_POST);
		if( $controller != '') {
			if( file_exists( $app_dir.'controllers/'.$controller.'_controller.php')) {
				echo $controller.' da ton tai.';
			}
		}
	}

	include( 'xtpl.php');

	$arrBTD[] = 'index';
	$arrBTD[] = 'edit';
	$arrBTD[] = 'addnew';
	$arrBTD[] = 'search';
	$arrBTD[] = 'list';

	$xtpl = new XTemplate( $dir.'template.html');

	foreach( $arrBTD as $value) {
		$xtpl->assign( 'action', $value);
		$xtpl->parse( 'main.loop');
	}

	$xtpl->parse();
	echo $xtpl->text();
	die();

}
